<?php
	//Xay dung tim kiem
	$ssFilter 		= $this->arrParam['ssFilter'];
	$page = '';
	if(isset($this->arrParam['page'])){
		$page = '/page/' . $this->arrParam['page'];
	}
	$action_link 	= $this->baseUrl($this->currentController . '/filter/type/order');
	$lblName 		= $this->cmsLinkSort('Cơ sở','c.name',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblMobile 		= $this->cmsLinkSort('Điện Thoại','c.mobile',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblAddress 		= $this->cmsLinkSort('Địa chỉ','c.address',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblEmail 		= $this->cmsLinkSort('Email','c.email',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblWebsite 		= $this->cmsLinkSort('Website','c.website',$ssFilter,$this->imgUrl . '/admin',$action_link);
	
	$lblID 			= $this->cmsLinkSort('ID','c.id',$ssFilter,$this->imgUrl . '/admin',$action_link);
	
	$lblStatus 		= $this->cmsLinkSort('Status','c.status',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblOrder 		= $this->cmsLinkSort('Order','c.order',$ssFilter,$this->imgUrl . '/admin',$action_link);
// 	$lblCategory	= $this->cmsLinkSort('Danh mục','category_name',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblhits		= $this->cmsLinkSort('Lượt xem','c.hits',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblLanguage	= $this->cmsLinkSort('Ngôn ngữ','c.lang_code',$ssFilter,$this->imgUrl . '/admin',$action_link);
	
	$keywords = $this->formText('keywords',$ssFilter['keywords'],array('class'=>'txtshort txtsearch'));
	
	//---------------------GROUP SELECTBOX --------------------//
// 	$linkSlbCategory = $this->baseUrl($this->currentController . '/filter/type/cat_id');
// 	$selectCategory = $this->cmsSelect('cat_id',$ssFilter['cat_id'],$this->slbCategory,array('style'=>'min-width:200px;','onchange'=>"OnSubmitForm('" .$linkSlbCategory ."')"));
	
	//---------------------SELECT BLOCKS --------------------//
	$linkBlocks = $this->baseUrl($this->currentController . '/filter/type/blocks');
	$slbBlocks = array(
						'0' => '- Bài viết thuộc Block -',
						'block_noibat'=> 'Tin nổi bật',
						'block_hot'=> 'Tin hot',
					);
	$selectBlocks = $this->formSelect('blocks',$ssFilter['blocks'],array('onchange'=>"OnSubmitForm('" .$linkBlocks ."')"),$slbBlocks);
	
	$selectLanguages = $this->slbLanguages;
	$linkSlbLanguages = $this->baseUrl($this->currentController . '/filter/type/lang');
	$selectLanguages = $this->formSelect('lang_code',$ssFilter['lang_code'],array('onchange'=>"OnSubmitForm('" .$linkSlbLanguages ."')"),$selectLanguages);
	
	$linkSearch = $this->baseUrl($this->currentController . '/filter/type/search/key/1');
	$btnResetSearch = $this->formButton('search-now','Tìm',array('class' => 'btnsearch', 'onclick'=>"OnSubmitForm('" .$linkSearch . "')"));
	
	$linkResetSearch = $this->baseUrl($this->currentController . '/filter/type/search/key/0');
	$btnResetSearch = $this->formButton('clear-keywords','Xóa',array('class' => 'btnsearch', 'onclick'=>"OnSubmitForm('" .$linkResetSearch ."')"));
	
	$strSearch = $keywords . ' ' . $btnResetSearch . ' ' . $btnResetSearch;

	//$strSearchRight = $selectBlocks . ' ' . $selectCategory . ' ' . $selectLanguages;
	$strSearchRight = $selectLanguages;
?>

<div class="left_content">
	<?php echo $this->render($this->arrParam['controller'] . '/toolbar/left.php');?>
	<div class="block_left">
		<div class="block_khung goc5">
			<div class="block_title goc3">
				<span class="toggleBlock db-up" id="block_3">&nbsp;</span>
				Khách hàng mới xem
			</div>
			<div class="block_content" id="block_3">
				<ul class="leftMenu">
					<li><a href="" class="icon-16-user-view">Anh Nam</a></li>
					<li><a href="" class="icon-16-groups">Tổ chức khách hàng</a></li>
					<li><a href="" class="icon-16-groups">Công ty dầu khí Việt Nam</a></li>
					<li><a href="" class="icon-16-user-view">Nguyễn Văn Nam</a></li>
					<li><a href="" class="icon-16-user-view">Chị Hương</a></li>
				</ul>
			</div>
		</div>
	</div>
</div>

<div class="right_content">
	<div class="block_breadcrumb">
		<?php echo $this->blkBreadcrumbs('default'); ?>
	</div>
	<div class="appContent">
	<?php echo $this->render($this->arrParam['controller'] . '/toolbar/index.php');?>
		
	<form action="" method="post" name="appForm">
	<script>
	$(function() {
	$( "#tabs" ).tabs();
	});
	</script>
	<div id="tabs">	
	<ul>
	<li><a href="#tabs-1">Danh sách cơ sở</a></li>
	</ul>		
	<div id="tabs-1">
	<div class="tblForm">
	
		
		<div class="formList goc5">
			<div class="appTop goct5">
				<div class="block_filter">
					<div class="fl">
						<div class="listSearch">
							<?php echo $strSearch; ?>
							<div class="clr"></div>			
						</div>
					</div>
					<div class="clr"></div>
				</div>
			</div>
			<div class="appBody">
				<table class="tblList">
					<tr>
						<th width="30"><input type="checkbox" id="checkall" class="checkbox"></th>
						<th><a href=""><?php echo $lblName;?></a></th>
						<th><a href=""><?php echo $lblMobile;?></a></th>
						<th><a href=""><?php echo $lblEmail; ?></a></th>
						<th><a href=""><?php echo $lblAddress; ?></a></th>
						<th><a href=""><?php echo $lblWebsite; ?></a></th>
						<th><a href="">Status</a></th>
						<th><a href="">Thao tác</a></th>
						<th><a href="">ID</a></th>
					</tr>
					
					<?php
				foreach ($this->Items as $key => $val){
					$id 			= $val['id'];
					$name 			= $val['name'];
					$mobile			= $val['mobile'];
					$email 			= $val['email'];
					$address 		= $val['address'];
					$website		= $val['website'];
					
					$status 		= $val['status'];
					if($status == 1){
						$linkStatus = $this->baseUrl($this->currentController . '/status/type/0/id/' . $id . $page);
						$status = $this->cmsIconButton('Kích vào để tắt', $this->imgUrl . '/admin/tick.png', $linkStatus);
					}else{
						$linkStatus = $this->baseUrl($this->currentController . '/status/type/1/id/' . $id . $page);
						$status = $this->cmsIconButton('Kích vào để bật', $this->imgUrl . '/admin/publish_x.png', $linkStatus);
					}
						
					$linkInfo		= $this->baseUrl($this->currentController . '/info/id/' . $id . $page);
					$btnInfo		= $this->cmsIconButton('Xem thông tin', $this->imgUrl . '/admin/icon_info.png', $linkInfo);
					
					$linkEdit		= $this->baseUrl($this->currentController . '/edit/id/' . $id . $page);
					$btnEdit		= $this->cmsIconButton('Sửa', $this->imgUrl . '/admin/icon_edit.png', $linkEdit);
					
					$linkDelete		= $this->baseUrl($this->currentController . '/delete/id/' . $id . $page);
					$btnDelete		= $this->cmsIconButton('Xóa', $this->imgUrl . '/admin/publish_r.png', $linkDelete);
					
					$strIconButton 	= $btnInfo . ' ' . $btnDelete;
					
					$alias = '<p class="smallsub">(Url: ' . $val['url'] . ' )</p>';
					$hoten 	= '<b><a href="' . $linkInfo . '">' . $hoten . '</a></b>';
				
					$cid 			= $this->formCheckbox('cid[]',$val['id']);
					
					$classRow = 'row1';
					if($key % 2 == 0)
					$classRow = 'row0';
						
			?>
			<tr class="<?php echo $classRow;?>">
				<td align="center"><?php echo $key + 1;?></td>
				<td align="left"><a href="<?php echo $linkEdit;?>"><?php echo $name;?></a></td>
				<td align="left"><a href="<?php echo $linkEdit;?>"><?php echo $mobile;?></a></td>
				<td align="left"><a href="<?php echo $linkEdit;?>"><?php echo $email;?></a></td>
				<td align="left"><a href="<?php echo $linkEdit;?>"><?php echo $address;?></a></td>
				<td align="center"><a href="<?php echo $linkEdit;?>"><?php echo $website;?></a></td>
				<td align="center"><?php echo $status;?></td>
				<td align="center"><?php echo $strIconButton;?></td>
				<td align="center"><?php echo $id;?></td>
			</tr>
			<?php
				} 
			?>
					
					<!-- 
					<tr>
						<td align="center"><input type="checkbox" value="598" class="checkbox" name="cid[]"></td>
						<td align="left"><a href="">Nguyễn Văn Nam</a></td>
						<td align="left">0902 171 042</td>
						<td align="left"><a href="">namtin17@gmail.com</a></td>
						<td align="center"><img src="<?php //echo $this->imgUrl . '/menu/icon-16-flag-active.png'; ?>"></td>
						<td align="left">Nhóm kinh doanh</td>
						<td align="left">Độ nóng</td>
						<td align="center">27/10/2013 15:03:53</td>
						<td align="left">
							<a href=""><img title="Sửa" src="<?php //echo $this->imgUrl . '/admin/icon_edit.png'; ?>"></a>
							<a href=""><img title="Xóa" src="<?php //echo $this->imgUrl . '/admin/icon_del.png'; ?>"></a>
						</td>
					</tr>
					 -->
				</table>
			</div>
			<div class="appBottom">
				<div class="pagination">
					<div class="limit">
						Display #
						<select onchange="appForm.submit();" size="1" class="select" name="limitPage" id="limitPage">
							<option selected="selected" value="5">5</option>
							<option value="10">10</option>
							<option value="15">15</option>
							<option value="20">20</option>
							<option value="25">25</option>
							<option value="30">30</option>
							<option value="50">50</option>
							<option value="100">100</option>
						</select>
					</div>
					<div class="page-right off">
						<div class="start">
							<span>Start</span>
						</div>
					</div>
					<div class="page-right off">
						<div class="prev">
							<span>Prev</span>
						</div>
					</div>
					<div class="page-left">
						<div class="page">
							<span>1</span>
							<a title="Page 2" href="">2</a>
						</div>
					</div>
					<div class="page-left">
						<div class="next">
							<a title="Next" href="">Next</a>
						</div>
					</div>
					<div class="page-left">
						<div class="end">
							<a title="End" href="">End</a>
						</div>
					</div>
					<div class="limit">Trang 1/2 - Tổng: <b>6</b></div>
				</div>
			</div>
		</div>
	</div>
	</div>
	</div>
	</form>
	</div>
</div>
<div class="clr"></div>	
